Skip to content

Conversation

@sachitv
Copy link

@sachitv sachitv commented Nov 24, 2025

This is based on the discussion here: #638

@ReagentX ReagentX mentioned this pull request Dec 2, 2025
@ReagentX ReagentX self-assigned this Dec 6, 2025
@ReagentX ReagentX added new feature Requires creating a new feature crate: cli Related to the CLI crate labels Dec 6, 2025
Copilot AI review requested due to automatic review settings January 9, 2026 17:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new --group-filter (-g) option to filter exported group conversations by their display names. The feature works independently or in conjunction with the existing --conversation-filter option, using set intersection when both are specified.

Key changes:

  • New CLI option --group-filter for filtering group chats by name
  • Runtime logic to resolve group names to chat IDs and intersect with existing filters
  • Comprehensive test coverage for various filter scenarios
  • Documentation updates explaining the intersection behavior

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
imessage-exporter/src/main.rs Adds call to resolve_filtered_groups() after handle resolution
imessage-exporter/src/app/options.rs Defines new CLI option, integrates into validation logic, updates test data
imessage-exporter/src/app/runtime.rs Implements group filter resolution logic, validation, and comprehensive tests
imessage-exporter/src/exporters/txt.rs Fixes hardcoded home directory path in test to use environment variable
imessage-exporter/src/exporters/html.rs Fixes hardcoded home directory path in test to use environment variable
imessage-exporter/README.md Documents new option and intersection behavior with conversation filter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

None => {
self.options
.query_context
.set_selected_chat_ids(matched_chat_ids.clone());
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .clone() call on matched_chat_ids is necessary here since the variable is moved into set_selected_chat_ids. However, you could avoid this clone by restructuring the logic. Instead of matching on a reference and then calling the method separately, you could consume matched_chat_ids directly in both branches. For example, use if let Some(existing) = self.options.query_context.selected_chat_ids.take() and then set the result in both branches.

Copilot uses AI. Check for mistakes.
Comment on lines +923 to +930
#[test]
fn can_build_option_group_filter() {
let command = get_command();
let args = command.get_matches_from(["imessage-exporter", "-g", "Family Chat", "-f", "txt"]);

let actual = Options::from_args(&args).unwrap();
assert_eq!(actual.group_filter, Some(String::from("Family Chat")));
}
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test only validates the group_filter field. Consider testing the complete Options struct (like other tests in this module) to ensure all fields are set correctly when using the group filter option.

Copilot uses AI. Check for mistakes.
Comment on lines +1830 to +1831
"Sticker from Sample Contact: {sticker_path} (App: Free People) from Sample Contact",
sticker_path = sticker_path
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sticker_path named parameter in the format! macro is redundant. The variable is already captured by name in the format string. Remove the explicit sticker_path = sticker_path parameter.

Suggested change
"Sticker from Sample Contact: {sticker_path} (App: Free People) from Sample Contact",
sticker_path = sticker_path
"Sticker from Sample Contact: {sticker_path} (App: Free People) from Sample Contact"

Copilot uses AI. Check for mistakes.
Comment on lines +2589 to +2590
"<img src=\"{sticker_path}\" loading=\"lazy\">\n<div class=\"sticker_name\">App: Free People</div> <div class=\"sticker_tapback\">&nbsp;by Sample Contact</div>",
sticker_path = sticker_path
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sticker_path named parameter in the format! macro is redundant. The variable is already captured by name in the format string. Remove the explicit sticker_path = sticker_path parameter.

Suggested change
"<img src=\"{sticker_path}\" loading=\"lazy\">\n<div class=\"sticker_name\">App: Free People</div> <div class=\"sticker_tapback\">&nbsp;by Sample Contact</div>",
sticker_path = sticker_path
"<img src=\"{sticker_path}\" loading=\"lazy\">\n<div class=\"sticker_name\">App: Free People</div> <div class=\"sticker_tapback\">&nbsp;by Sample Contact</div>"

Copilot uses AI. Check for mistakes.
Comment on lines +328 to +332
let parsed_group_filter = group_filter
.split(',')
.map(str::trim)
.filter(|token| !token.is_empty())
.collect::<Vec<&str>>();
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsing logic in resolve_filtered_groups includes .map(str::trim) and .filter(|token| !token.is_empty()), but the similar logic in resolve_filtered_handles (line 288) does not. Consider applying the same trimming and empty-token filtering to resolve_filtered_handles for consistency, or document why the difference is intentional.

Copilot uses AI. Check for mistakes.
@ReagentX
Copy link
Owner

ReagentX commented Jan 9, 2026

Ignore copilot for now; I haven not yet decided if I want to include this feature yet.

@sachitv
Copy link
Author

sachitv commented Jan 23, 2026

@ReagentX any update on this yet?

@ReagentX
Copy link
Owner

Not yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crate: cli Related to the CLI crate new feature Requires creating a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants